# 构建数组和target
var nums = [2,7,11,15];
var target = 9;

# 定义两数之和函数
function twoSun(nums,target){
    var n = nums.length();
    for(var i = 0; i < n; i=i+1){
        for(var j = 0; j < n; j=j+1){
            if(nums[i] + nums[j] == target){
                return [i,j];
            }
        }
    }
    return [];
}

# 执行并打印结果
print(twoSun(nums,target));